<template>
	<view >
		
		<view v-show="xzshow==1" style=" z-index: 100; height: 100%; width: 100%;background-color: #000;opacity: 0.8;position: fixed;top: 0;left: 0;"></view>
		
		<view style="background: #fff; z-index: 101; position: fixed;top: 30%;left:10%;width: 80%;height: 580rpx;z-index: 111;border-radius: 24rpx;text-align: center;
		 " v-show="xzshow==1 && lang=='zh'">
			<view style="margin-top: 60rpx;font-size: 30rpx;font-weight: bolder;">
				{{$t("选择类型")}}
			</view>
			<view style="margin-top: 30rpx;" v-for="(item, index) in fblist"
			      :key="index"
			      :class="{ 'list-item': true, 'active': selectedIndexs === index }"
			      @click="selectItem(index)">
				{{ item.name }}
			</view>
			<view>
				<view style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 15%;" @click="fblxClick">
					{{$t("确认")}}
				</view>
				<view style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 20rpx;" @click="fbqxClick">
					{{$t("取消")}}
				</view>
			</view>
		</view>
		<view style="background: #fff;position: fixed;top: 30%;left:10%;width: 80%;height: 580rpx;z-index: 111;border-radius: 24rpx;text-align: center;
		 " v-show="xzshow==1 && lang=='ru'">
			<view style="margin-top: 30rpx;font-size: 30rpx;font-weight: bolder;">
				{{$t("选择发布类型")}}
			</view>
			<view style="margin-top: 30rpx;" v-for="(item, index) in fblist"
			      :key="index"
			      :class="{ 'list-items': true, 'active': selectedIndexs === index }"
			      @click="selectItem(index)">
				{{ item.name }}
			</view>
			<view>
				<view style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 15%;" @click="fblxClick">
					{{$t("确认")}}
				</view>
				<view style="font-size: 28rpx;background-image:linear-gradient(to right, #f3892c, #fc674d);color: #fff;width: 200rpx;text-align: center;border-radius: 36rpx;height: 70rpx;line-height: 70rpx;margin: 0 auto;margin-top: 35rpx;float: left;margin-left: 20rpx;" @click="fbqxClick">
					{{$t("取消")}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {HTTP_REQUEST_URL,HTTP_IMG_UTL,IMAGE_URL} from "@/config/app";
	
	export default {
		components: {
			
		},
		props: {
			xzshow:{
				type: Number,
				default:0
			},
			order:{
				type:[Object,null],
				default:{}
			},
			is_crossborder:{
				type: Number,
				default:''
			},
		},
		data() {
			return {
				//远程域名
				HTTP_IMG_UTL,
				HTTP_REQUEST_URL,
				IMAGE_URL,
				url: IMAGE_URL,
				
				//语言
				lang: this.$i18n.locale,
				//文字
				fblist: [
					{ name: this.$t('匹配-运输') },
					{ name: this.$t('匹配-货代') },
					{ name: this.$t('匹配-小件快递') }
				  ],
				selectedIndexs: 0 ,// 初始未选中任何项
				
			}
		},
		methods:{
			selectItem(index) {
			  this.selectedIndexs = index;
			},
			fbqxClick(){
				this.$emit('change',1)
			},
			fblxClick(){
				var that = this
				var message = that.$t('即将跳转竞标-有货求车发布界面\n您可分段发布物流运输或发布全程物流运输')
				
				if(that.selectedIndexs==1){
					uni.navigateTo({
						url:"/pages/release/crossborder/form?type=2&goods="+JSON.stringify(that.order.orderInfo.release_info)+"&main_order_id="+that.order.orderInfo.join_order_id
					})
					return;
				}else if(that.selectedIndexs==2){
					uni.navigateTo({
						url:"/pages/release/transport/form?type=2&leixing=2&goods="+JSON.stringify(that.order.orderInfo.release_info)+"&main_order_id="+that.order.orderInfo.join_order_id
					})
					return;
				}
				
				
				uni.showModal({
				  title: that.$t("系统提示"),
				  content: message,
				  confirmText: that.$t("是"),
				  cancelText: that.$t("否"),
				  success(e) {
				    if (e.confirm) {
						if(that.selectedIndexs==0){
							uni.navigateTo({
								url:"/pages/release/transport/form?type=2&leixing=1&goods="+JSON.stringify(that.order.orderInfo.release_info)+"&main_order_id="+that.order.orderInfo.join_order_id
							})
						}else if(that.selectedIndexs==1){
							uni.navigateTo({
								url:"/pages/release/crossborder/form?type=2&goods="+JSON.stringify(that.order.orderInfo.release_info)+"&main_order_id="+that.order.orderInfo.join_order_id
							})
						}else if(that.selectedIndexs==2){
							uni.navigateTo({
								url:"/pages/release/transport/form?type=2&leixing=2&goods="+JSON.stringify(that.order.orderInfo.release_info)+"&main_order_id="+that.order.orderInfo.join_order_id
							})
						}
						
				    }
				  }
				})
			}
		},
		mounted() {
			console.log(this.is_crossborder)
			if(this.is_crossborder==1){
				this.fblist=[
					{ name: this.$t('匹配-运输') }
				  ]
			}
		}
	}
</script>

<style lang="scss" >
	.list-item {
	  padding: 23rpx 18rpx;
	  font-size: 28rpx;
	  // background: #018ff2;
	  width: 50%;
	  color: #000;
	  border-radius: 12rpx;
	  margin: 0 auto;
	  margin-top: 3%;
	}
	.active {
	  background-color: #018ff2; /* 选中的颜色 */
	  color: #fff;
	}
</style>